package com.heisenhub.common.db.model;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.heisenhub.common.oauth.holder.LoginUserHolder;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;

public class CreateBase {

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 创建人
     */
    private String creator;

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getCreator() {
        return StringUtils.isBlank(creator) ? LoginUserHolder.loginUser().getUsername() : creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }
}
